#!/bin/bash
echo "++++++++++++++++++ocserv install"
yum install epel-release -y       
yum install ocserv lrzsz  -y
mv ocserv.conf /etc/ocserv/ocserv.conf -f
mv ocpasswd /etc/ocserv/ocpasswd -f
echo "++++++++++++++++++touch ocpasswd"
touch /etc/ocserv/ocpasswd
echo "++++++++++++++++++ip_forward"
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf && sysctl -p 
echo "++++++++++++++++++stop firewalld"
systemctl disable --now firewalld 
systemctl stop firewalld 
yum install iptables* -y
iptables-restore < iptables.txt
echo "++++++++++++++++++start ocserv"
systemctl enable --now ocserv
systemctl restart ocserv  

echo "ocserv服务已经完成安装"
echo "++++++++++++++++++测试用户"
echo "测试用户:yyp"
echo "测试密码:yyp2021"
echo "++++++++++++++++++ 管理用户"
echo "创建用户：ocpasswd -c /etc/ocserv/ocpasswd yyp"
echo "删除用户：ocpasswd -c /etc/ocserv/ocpasswd -d yyp"
echo "++++++++++++++++++客户端配置"
echo "windowns系统客户端下载地址：https://www.aliyundrive.com/s/oanLSTLdWuo"
echo "AnyConnect Secure需要修改Preferneces下参数只需要勾选下面两个参数"
echo "- Minize AnyConnect on VPN connnet"
echo "- Allow local(LAN) access when using VPN (if configured)"